package com.usian.controller;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import java.util.Optional;

@Component
public class consumer {


    @KafkaListener(topics = "{topic1}")
    public void receiverMessage(ConsumerRecord<?,?> record){

        Optional<? extends ConsumerRecord<?, ?>> optional = Optional.ofNullable(record);
        if (optional.isPresent()){
            Object value = record.value();
            System.out.println("message=="+value);
        }


    }
}
